#ifndef _LuminousMaterial_H_
#define _LuminousMaterial_H_

#pragma once
#include "Material.h"

class LuminousMaterial : public Material {
private:
	shared_ptr<Material> material;
	Color colorStrength;

public:
	LuminousMaterial(Float intensity = 1) {
		setStrength(intensity);
	}
	LuminousMaterial(shared_ptr<Material> material, Float intensity = 1) : material(material) {
		setStrength(intensity);
	}
	~LuminousMaterial() {}

	bool isLuminous() const {
		return true;
	}

	Color shade(const Scene *scene, const Ray &ray, const IntersectResult &intersect, const TraceState & traceState) const {
		return material ? strength *= material->shade(scene, ray, intersect, traceState) : colorStrength;
	}

	void setStrength(Float strength) {
		this->strength = strength;
		colorStrength = Colors::White * strength;
	}
};

#endif // _LuminousMaterial_H_